﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DarazSdk
{
    /// <summary>
    /// 请求结果 
    /// </summary>
    public class DarazResult<T>
    {
        /// <summary>
        /// 是否成功请求
        /// </summary>
        public bool IsSuccess { get; set; } = false;

        /// <summary>
        /// 请求成功数据
        /// </summary>
        public T Body { get; set; }

        /// <summary>
        /// 请求成功请求头
        /// </summary>
        public SuccessHeader SuccessHeader { get; set; }


        /// <summary>
        /// 请求错误数据
        /// </summary>
        public ErrorResponse ErrorResponse { get; set; }


        /// <summary>
        /// 原始字符串 当解析错误的时候该值有值
        /// </summary>
        public string ResponseBody { get; set; } = string.Empty;
    }

    /// <summary>
    /// 生成响应头
    /// </summary>
    public class SuccessHeader
    {
        /// <summary>
        /// 请求ID
        /// </summary>
        public string RequestId { get; set; } = string.Empty;

        /// <summary>
        /// 请求接口
        /// </summary>
        public string RequestAction { get; set; } = string.Empty;

        /// <summary>
        /// 
        /// </summary>
        public string ResponseType { get; set; } = string.Empty;

        /// <summary>
        /// 
        /// </summary>
        public DateTime Timestamp { get; set; }
    }



    /// <summary>
    /// 错误响应结果
    /// </summary>
    public class ErrorResponse
    {
        /// <summary>
        /// 
        /// </summary>
        public string RequestAction { get; set; } = string.Empty;

        /// <summary>
        /// 
        /// </summary>
        public string ErrorType { get; set; } = string.Empty;

        /// <summary>
        /// 
        /// </summary>
        public int ErrorCode { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string ErrorMessage { get; set; } = string.Empty;
    }

}
